/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Alvaro
 */
public class DateConverter {
    
    public static String convertDateToString(Date date){
        SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy - HH:mm");
        String dateString = sdf.format(date);
        return dateString;
    }
    
    public static Integer dateDifference(Date compare){
        Date now=new Date();
        Date compare1=compare;
        if(compare==null){
            compare1=now;
        }
        long diff=now.getTime()-compare1.getTime();
        long days=diff / 1000 / 60 / 60 / 24 / 365;
        return (int)days;
    }
}
